var userEdit = function () {
    var editinfo = function () {
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) {
                return decodeURI(r[2]);
            } else {
                return null;
            }
        };
        layui.use(['form', 'layer', 'table'], function () {
            var form = layui.form
                , layer = layui.layer
                , table = layui.table;

            //显示元数据
            $("#strNo").val(GetQueryString("id"));
            $("#strName").val(GetQueryString("name"));
            $("#strAge").val(GetQueryString("age"));
            $("#strNumber").val(GetQueryString("number"));
           /* if (GetQueryString("sex") === '女') {
                $("input[type=radio][name=strSex][value='2']").prop('checked', true);
                form.render("radio");
            }*/
            //监听提交
            form.on('submit(add)', function (data) {
                // 获得frame索引
                var data = {
                    id: GetQueryString("id"),
                    name: $("#strName").val(),
                   // sex: $('#strSex input[name="strSex"]:checked').val(),
                    number: $("#strNumber").val(),
                    age: $("#strAge").val(),
                }
                $.ajax({
                    url: "/user/save",
                    type: "post",
                    data: JSON.stringify(data)
                    , datatype: "json"
                    , contentType: 'application/json'
                    , success: function (result) {
                        //var obj = JSON.parse(result);
                        if (result.code == 200) {

                            // 获得frame索引
                            var index = parent.layer.getFrameIndex(window.name);
                            //关闭当前frame
                            parent.layer.close(index);
                            // 可以对父窗口进行刷新
                            x_admin_father_reload();
                        } else {
                            layer.msg(result.msg)
                        }
                    }
                });
                //同步修改
                /*$.ajax({
                    url: "/synchronys/B/update.do",
                    type: "post",
                    data: JSON.stringify(data)
                    , datatype: "json"
                    , contentType: 'application/json'
                    , success: function (result) {
                        if (result.resultCode != 200) {
                            layer.msg("同步修改失败")
                        }
                    }
                });*/
                return false;
            });
        })
    };
    return {
        init: function () {
            editinfo();
        }
    };
}();